package question

//2325. 解密消息
func decodeMessage(key string, message string) string {
	m := make(map[byte]byte, 0)
	count := 0
	for _, v := range []byte(key) {
		if v == ' ' {
			continue
		}
		if _, ok := m[v]; !ok {
			m[v] = byte('a' + count)
			count++
		}
	}
	res := make([]byte, 0)
	for _, v := range []byte(message) {
		if v == ' ' {
			res = append(res, ' ')
		} else {
			res = append(res, m[v])
		}
	}
	return string(res)
}
